package org.example.mapper;

import org.apache.ibatis.annotations.Select;
import org.example.pojo.domain.Reservation;

import java.util.Date;
import java.util.List;

public interface ReservationMapper {
    // 查询某用户的所有预约
    List<Reservation> findByUserId(Integer userId);
    // 根据预约 ID 查询预约
    Reservation findById(Integer reservationId);
    // 插入新预约
    void insertReservation(Reservation reservation);
    // 更新预约状态
    void updateReservationStatus(Integer reservationId, String status);
    // 删除预约
    void deleteReservation(Integer reservationId);

    // 获取当天的预约人数
    @Select("SELECT COUNT(*) FROM reservation WHERE status = 'confirmed' AND DATE(reserved_time) = CURDATE()")
    int countConfirmedVisitorsByDate(Date date);
}
